<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>添加一本书籍</button>

    <script src="./axios.js"></script>

    <script>
        // 给按钮添加点击事件
        document.querySelector('button').addEventListener('click', function () {
            axios({
                method: 'POST',
                url: 'http://www.itcbc.com:3006/api/addbook',
                // 提交的数据用data
                data: {
                    bookname: '三国',
                    author: '张三',
                    publisher: '北京出版社',
                    appkey:'heshun'
                }
            }).then(({ data: a }) => {
                console.log(a)
            })
        })
    </script>
</body>

</html>